<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<p id="description">There was a bug that moving focus with TAB from a number input with an invalid string dispatched an extra focus event and an extra blur event.</p>
<div id="console"></div>

<input type=number id=number>
<input type=text>

<script>
function handleFocus() {
    numOfFocus++;
}

function handleBlur() {
    numOfBlur++;
}

var numOfFocus = 0;
var numOfBlur = 0;
var num = document.getElementById('number');
num.addEventListener('focus', handleFocus);
num.addEventListener('blur', handleBlur);
num.focus();
document.execCommand('InsertText', false, '123');
document.execCommand('InsertText', false, 'a');
eventSender.keyDown('\u0009');

shouldBe('numOfFocus', '1');
shouldBe('numOfBlur', '1');
</script>
</body>
</html>
